const asrService = require('./asrService');

exports.main = async (event, context) => {
  try {
    const { audioData, sessionId } = event;
    
    if (!audioData) {
      throw new Error('音频数据不能为空');
    }

    // 调用实时语音识别服务
    const result = await asrService.recognizeRealtime(audioData, sessionId);
    
    return {
      code: 0,
      message: 'success',
      data: result
    };
  } catch (error) {
    console.error('实时语音识别失败:', error);
    return {
      code: -1,
      message: error.message || '实时语音识别失败',
      data: null
    };
  }
};